<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h4 class="modal-title">编辑标签</h4>
</div>
<form id="edit-tag-form" action="/xqc/quality/fba-customer-return-ajax" method="post">
    <div class="modal-body">
        <div class="row">
            @foreach(\App\Models\Quality\QDictTag::$_type as $key => $value) 
                <div class="form-group" style="padding-bottom: 30px;">
                    <label style="padding-top: 8px;text-align: right;" class="col-sm-3 control-label">{{ $value }}</label>
                    <div class="col-sm-8">
                        <select class="tag" name="param[tag][{{ $key }}][]" multiple>
                            {{ getMultipleOptions(\App\Models\Quality\QDictTag::options(['type' => $key]),$qc->tag[$key] ?? [],false) }}
                        </select>
                    </div>
                </div>
            @endforeach
        </div>
    </div>
    <div class="modal-footer">
        {{ csrf_field() }}
        <input type="hidden" name="param[id]" value="{{ $id }}">
        <input type="hidden" name="action" value="doEditTag">
        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
        <button type="submit" class="btn btn-primary">提交</button>
    </div>
</form>
<script language="JavaScript" type="text/javascript">
    $(function () {
        $(".tag").select2({"allowClear":true, "placeholder":"请选择标签","width": '100%'});
        $("#edit-tag-form").ajaxForm(function (data) {
            if (typeof data === 'object') {
                if (data.status) {
                    $("#myModal").modal('hide');
                    $(".modal-backdrop").remove();
                    $('body').removeClass('modal-open');
                    toastr.success('提交成功 !');
                    $.pjax.reload('#pjax-container');
                } else {
                    swal(data.message, '', 'error');
                }
            }
        });
    });
</script>
